﻿using UnityEngine;
using System.Collections;

public class moveplatform : MonoBehaviour
{

	public float velocity = 1;
	
	public float time = 1;
	
	float initialTime;
	
	// Use this for initialization
	void Start () 
	{
		initialTime = time;	
	}
	
	// Update is called once per frame
	void Update ()
	{
			
		transform.Translate(-velocity * Time.deltaTime, 0, 0);
		
		time -= Time.deltaTime;
		
		if(time <= 0)
		{
			time = initialTime;
			
			velocity *=-1;
		}
	}
}
